import React, { useMemo } from 'react';
import PrintItem from './../PrintItem';

const App = (props,) => {

  const { formItemProps, selectProps, initialValue } = props;

  const value = useMemo(() => {
    if (selectProps?.dataSource && initialValue) {
      const res = selectProps.dataSource.filter(item => item.value === initialValue);
      return res?.[0]?.['label'] || '';
    }
    return '';
  }, [selectProps, initialValue]);

  return (
    <PrintItem
      style={formItemProps?.style || {}}
      label={localStorage.i18nextLng === 'en' ? formItemProps?.labelEn : formItemProps?.label}>
      {value}
    </PrintItem>
  );
};

export default App;